import CardCom from './Card'
import Vue from 'vue'

/**
 * @param { HTMLDivElement | string } dom
 * @param { object } opt
 * @param { Function } call - 关闭回调
 */
export const createCard = (dom, opt, call) => {
  const d1 = document.createElement('div')
  dom.appendChild(d1)
  const App = Vue.extend(CardCom)
  const app1 = new App({
    propsData: opt
  })
  app1.$on('deleteNode', () => {
    app1.$destroy()
    call()
  })

  app1.$mount(d1)

  return app1
}
